package org.example.innovate.controller;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.example.innovate.common.CommonResponse;
import org.example.innovate.domain.History;
import org.example.innovate.service.HistoryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

@RestController
@RequestMapping("/history")
@Valid
public class HistoryController {
    @Resource
    private HistoryService historyService;

    @GetMapping("/get")
    private CommonResponse<List<History>> get(HttpServletRequest request) {
        return historyService.getAll(request);
    }

    @PostMapping("/delete")
    private CommonResponse<List<History>> delete(HttpServletRequest request) {
        return historyService.delete(request);
    }
}
